interface AskIconItemProps {
  askColor: string
  answerColor: string
}
interface AskIconProps {
  [name: string]: AskIconItemProps
}

const askIconColor: AskIconProps = {
  shenzhen: { askColor: '#FF0012', answerColor: '#3b5df3' },
  dongguan: { askColor: '#333', answerColor: '#f20' }
}

var app = getApp()

Component({

  /**
   * 组件的属性列表
   */
  properties: {
    data: {
      type: Object,
      value: {}
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    themeCode: '',
    iconColor: { askColor: '#FF0012', answerColor: '#3b5df3' }
  },
  lifetimes: {
    attached() {
      //从本地获取当前选择的城市编码
      const themeCode = wx.getStorageSync('themeCode')
      this.setData({
        themeCode,
        iconColor: app.globalData.dictMap.get('askIconColor') 
      })
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    //打开对应的问题内容
    onOpenPage() {
      wx.setStorageSync('question', this.properties.data)
      wx.navigateTo({ url: '../../pages/question/answer/answer?id=' + this.properties.data.id })
    }
  }
})